import 'package:json_annotation/json_annotation.dart';

part 'login_res.g.dart';

@JsonSerializable()
class LoginRes {
  final int? code;
  final Data? data;
  final String? msg;

  const LoginRes({
    this.code,
    this.data,
    this.msg,
  });

  factory LoginRes.fromJson(Map<String, dynamic> json) =>
      _$LoginResFromJson(json);

  Map<String, dynamic> toJson() => _$LoginResToJson(this);
}

@JsonSerializable()
class Data {
  final int? userId;
  final String? accessToken;
  final String? refreshToken;
  final int? expiresTime;

  const Data({
    this.userId,
    this.accessToken,
    this.refreshToken,
    this.expiresTime,
  });

  factory Data.fromJson(Map<String, dynamic> json) =>
      _$DataFromJson(json);

  Map<String, dynamic> toJson() => _$DataToJson(this);
}
